%Paul Ozog
% Final Exam Problem 3

T = 1e-3;
SPB = 16;
letters = [' ABCDEFGHIJKLMNOPQRSTUVWXYZ'];

contents = open('problem3.mat');
v = contents.v;

g = ones(1,SPB);

y = conv(g, v);

yn = [];
for i=SPB:SPB:length(y)-1
  yn = [yn y(i)];
end

dec = yn > 0;

%split dec into 5 bits each

bin = [];

for i=1:5:length(yn)-4
  bin = [bin dec(i:i+4)'];
end
bin = bin';

dec = [];
for i=1:size(bin, 1)
  dec = [dec bin2dec(dec2hex(bin(i, :))')];
end

message = letters(dec+1);

message
